Popular Searches
Popular Course Categories
Popular Courses

Preparing Flutter App for Release

Preparing Flutter App for Release

Flutter Deployment

Preparing Flutter App for Release

Preparing a Flutter application for release means getting the application ready for real users and production distribution. A release build is optimized for performance, removes development-only debugging features, and is packaged for platforms such as Google Play Store, Apple App Store, web hosting, or desktop distribution.

For Android applications, the release preparation process generally includes reviewing the application configuration, updating the app identity and version, checking assets and permissions, configuring release signing, testing the release build, and finally generating an Android App Bundle (AAB) or APK.


1. What is a Release Build?

A release build is the production-ready version of a Flutter application intended for end users. Flutter's release mode is optimized for fast startup, efficient execution, and smaller package size. Assertions and debugging information are removed or disabled in release mode.

Development Build vs Release Build

FeatureDebug BuildRelease Build
PurposeDevelopment and debuggingProduction and distribution
DebuggingEnabledDisabled
AssertionsEnabledDisabled
PerformanceDevelopment-orientedOptimized
Hot ReloadAvailableNot available
Package SizeUsually largerOptimized
UseDeveloper testingEnd users

2. Release Preparation Workflow

A typical Flutter release preparation workflow can be represented as follows:

Develop Application
        ↓
Test Application
        ↓
Remove Debug/Test Data
        ↓
Update App Name and Icon
        ↓
Review Dependencies
        ↓
Update Version
        ↓
Configure Application ID
        ↓
Review Permissions
        ↓
Configure Release Signing
        ↓
Test Release Build
        ↓
Build AAB/APK
        ↓
Final Quality Check
        ↓
Publish Application

3. Verify the Flutter Environment

Before preparing the application for release, verify that the Flutter development environment is working correctly.

flutter doctor

For detailed environment information, use:

flutter doctor -v

The command helps identify problems related to Flutter, Dart, Android SDK, Android Studio, Java, connected devices, and other development dependencies.

Check Flutter Version

flutter --version

Check Available Devices

flutter devices

4. Clean the Project Before Release

Cleaning the project can remove previously generated build files and cached artifacts. This can be useful when preparing a fresh release build or after changing Android Gradle or signing configuration.

flutter clean
flutter pub get

After cleaning, rebuild and test the application.


5. Review the Application

Before creating a release build, carefully review the entire application. Development-only content should not be included in the production version.

Check the Following Items

  • Remove test screens and temporary widgets.
  • Remove sample or dummy data.
  • Remove debug print statements where they are no longer required.
  • Check navigation routes.
  • Check forms and validation.
  • Check authentication and logout functionality.
  • Check API endpoints.
  • Check error handling.
  • Check loading indicators.
  • Check empty-state screens.
  • Check offline behavior.
  • Check permissions.
  • Check application branding.

6. Review pubspec.yaml

The pubspec.yaml file contains important project information such as the application version and dependencies.

Example

name: my_flutter_app
description: A Flutter application
version: 1.0.0+1
environment:
  sdk: ">=3.0.0 <4.0.0"
dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.8
dev_dependencies:
  flutter_test:
    sdk: flutter

Before release, make sure that unnecessary dependencies are removed and required dependencies are updated and tested.


7. Update the Application Version

Flutter applications commonly define their version in pubspec.yaml.

version: 1.0.0+1

The first part represents the user-visible version name, while the number after the + represents the build number.

ValueMeaning
1Major version
0Minor version
0Patch version
1Build number

Example Version Updates

version: 1.0.0+1
version: 1.0.1+2
version: 1.1.0+3
version: 2.0.0+10

When building Android, Flutter maps the build name to Android's versionName and the build number to versionCode.

Override Version During Build

flutter build appbundle --build-name=1.2.0 --build-number=10

8. Configure a Unique Application ID

The Android application ID uniquely identifies the application on Android devices and Google Play.

It is commonly defined in the Android Gradle configuration:

defaultConfig {
    applicationId = "com.example.myapp"
}

A production application should use a unique identifier, for example:

applicationId = "com.companyname.myapp"

The application ID should be carefully selected before publishing because changing it after the application has been uploaded to Google Play creates a different application identity.


9. Review the Android Manifest

The Android manifest is located at:

android/app/src/main/AndroidManifest.xml

Example

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:label="My Flutter App"
        android:icon="@mipmap/ic_launcher">
        ...
    </application>
</manifest>

Important Manifest Checks

  • Verify the final application name.
  • Verify the launcher icon.
  • Review Internet permission if the application communicates with online services.
  • Review other permissions used by plugins.
  • Remove permissions that are not required.
  • Check activity configuration.

10. Configure the Application Name

The name displayed to users should be the final production application name rather than a temporary development name.

For Android, review the android:label attribute:

<application
    android:label="My Flutter App"
    android:icon="@mipmap/ic_launcher">

11. Configure the Application Icon

A professional launcher icon is an important part of release preparation. The default Flutter icon should normally be replaced with the application's final branding.

Icon Checklist

  • Use the final application logo.
  • Prepare appropriate Android icon assets.
  • Check adaptive icon requirements.
  • Verify the icon on different device launchers.
  • Make sure the icon is not blurry or incorrectly cropped.

Using flutter_launcher_icons

A commonly used approach is to configure launcher icons through a package.

dev_dependencies:
  flutter_launcher_icons: ^latest

After configuring the package according to its documentation, generate the icons and verify them on a physical device.


12. Review Application Assets

Production applications should contain only the assets that are actually required.

Check Assets

  • Application logo
  • Images
  • Fonts
  • Animations
  • JSON files
  • Configuration files
  • Localization files

Example asset configuration:

flutter:
  assets:
    - assets/images/
    - assets/icons/

13. Review Dependencies

Third-party packages can affect application size, compatibility, permissions, and release behavior. Review the dependencies before publishing.

flutter pub get
flutter pub outdated

Remove packages that are no longer required.

Dependency Checklist

  • Is the package required?
  • Is the package compatible with the current Flutter version?
  • Does the package require additional Android permissions?
  • Does it work in release mode?
  • Does it introduce unnecessary application size?
  • Has it been tested on physical devices?

14. Test Release Mode Locally

Before generating the final release package, run the application in release mode.

flutter run --release

Release-mode testing is important because an application may behave differently from debug mode.

Test Important Features

  • Application startup
  • Login and registration
  • API requests
  • Database operations
  • Firebase integration
  • Push notifications
  • Image loading
  • File upload/download
  • Payment flows
  • Deep links
  • Navigation
  • Permissions
  • Background operations

15. Release Signing

Android applications distributed through Google Play must be digitally signed. For Play App Signing, developers generally work with an upload key while Google Play manages the app signing key.

Why Signing is Required

  • It identifies the publisher of the application.
  • It helps protect application updates.
  • It establishes trust between releases.
  • It is required for Android app distribution.

16. Create an Upload Keystore

If an upload keystore does not already exist, it can be created using the Java keytool command.

Windows PowerShell

keytool -genkey -v -keystore $env:USERPROFILE\upload-keystore.jks `
-storetype JKS -keyalg RSA -keysize 2048 -validity 10000 `
-alias upload

macOS/Linux

keytool -genkey -v -keystore ~/upload-keystore.jks \
-storetype JKS -keyalg RSA -keysize 2048 -validity 10000 \
-alias upload

The keystore contains sensitive signing credentials and should never be committed to a public source-control repository.


17. Create key.properties

A common Flutter Android release setup stores keystore information in:

android/key.properties

Example

storePassword=your-store-password
keyPassword=your-key-password
keyAlias=upload
storeFile=C:\Users\YourName\upload-keystore.jks

Do not publish passwords or private signing files in a public repository.


18. Configure Release Signing in Gradle

The Android Gradle configuration needs to reference the release signing configuration.

Example Kotlin Gradle Configuration

import java.util.Properties
import java.io.FileInputStream

val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")

if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}

android {
    signingConfigs {
        create("release") {
            keyAlias = keystoreProperties.getProperty("keyAlias")
            keyPassword = keystoreProperties.getProperty("keyPassword")
            storeFile = keystoreProperties.getProperty("storeFile")?.let {
                file(it)
            }
            storePassword = keystoreProperties.getProperty("storePassword")
        }
    }

    buildTypes {
        release {
            signingConfig = signingConfigs.getByName("release")
        }
    }
}

After changing signing or Gradle configuration, running a clean build can help prevent cached configuration from affecting the result.

flutter clean
flutter pub get

19. Protect Signing Credentials

Signing credentials are extremely important. They should be protected carefully.

Do Not Commit These Files Publicly

android/key.properties
*.jks
*.keystore

A project's .gitignore should be configured appropriately so sensitive files are not accidentally committed.

Best Practices

  • Use secure password storage.
  • Keep backup copies of signing credentials in a secure location.
  • Never share keystore passwords in public repositories.
  • Do not send signing files through unsecured communication channels.
  • Use protected CI/CD secrets when building releases automatically.

20. Review Android SDK Configuration

Review the Android configuration used by the application.

android {
    namespace = "com.example.myapp"

    defaultConfig {
        applicationId = "com.example.myapp"
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }
}

Important SDK Values

ConfigurationPurpose
compileSdkAndroid SDK used to compile the application
minSdkOldest Android version supported
targetSdkAndroid version the application is designed and tested for
applicationIdUnique Android application identifier
versionCodeInternal Android build version
versionNameUser-visible application version

21. Review Internet and Network Configuration

If the application communicates with APIs, Firebase services, authentication servers, or other online services, verify the network configuration.

<uses-permission android:name="android.permission.INTERNET"/>

Also verify:

  • Production API URLs are being used.
  • Development API endpoints are removed.
  • HTTPS is used wherever possible.
  • Authentication credentials are configured correctly.
  • API error responses are handled.
  • Network timeout handling works correctly.

22. Remove Debug Information

Before release, remove unnecessary debugging output and development-only configuration.

Example

print("User login response: $response");

Debug logging should not expose passwords, tokens, personal information, API keys, or other sensitive data.


23. Review Environment Configuration

Many applications have different configurations for development, testing, staging, and production.

Development
    ↓
Testing
    ↓
Staging
    ↓
Production

Example

const String apiUrl = "https://api.example.com";

Make sure the release build points to the production services instead of local development addresses such as:

http://localhost:3000
http://10.0.2.2:3000

24. Configure Build Flavors When Required

Build flavors can be useful when an application needs separate development, staging, and production configurations.

Example Environment Structure

Development → Debug API → Development App
Staging     → Test API  → Staging App
Production  → Live API  → Production App

Flavors should be configured carefully so that production builds cannot accidentally connect to test services.


25. Code Optimization

Release builds are optimized by Flutter and Android build tooling. Android release builds also use R8 code shrinking.

Optimization can help reduce unnecessary application code and package size, but release builds should always be tested after optimization.

Things to Check

  • Remove unused dependencies.
  • Compress large images where appropriate.
  • Avoid unnecessary assets.
  • Review large fonts and media files.
  • Use efficient widgets and layouts.
  • Reduce unnecessary rebuilds.
  • Test application startup performance.

26. Dart Code Obfuscation

Flutter supports Dart code obfuscation for release builds. Obfuscation changes symbols in the compiled application, making reverse engineering more difficult.

Example

flutter build appbundle --obfuscate --split-debug-info=build/symbols

The generated symbol information should be stored securely because it can be required later to decode obfuscated stack traces.


27. Check Application Performance

Performance should be tested before publishing the application.

Performance Checklist

  • Application starts quickly.
  • Screen transitions are smooth.
  • Lists scroll smoothly.
  • Images load efficiently.
  • API requests do not block the UI unnecessarily.
  • Animations perform smoothly.
  • Memory usage is reasonable.
  • Battery consumption is acceptable.

28. Test on Physical Devices

Testing only on an emulator is not sufficient for a production application. Test the release build on physical devices whenever possible.

Test Different Conditions

  • Different screen sizes
  • Different Android versions
  • Different device manufacturers
  • Slow Internet connection
  • No Internet connection
  • Low battery
  • Different orientation settings
  • Permission denial
  • Application restart
  • Application update

29. Generate Android App Bundle

For Google Play distribution, an Android App Bundle is the preferred release format.

flutter build appbundle

The generated bundle is normally located at:

build/app/outputs/bundle/release/app.aab

The App Bundle allows Google Play to generate optimized APKs for individual user devices.


30. Generate Release APK

An APK may be required when distributing an application outside Google Play or for certain testing and distribution scenarios.

flutter build apk --split-per-abi

This generates ABI-specific APK files such as:

build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
build/app/outputs/flutter-apk/app-x86_64-release.apk

Single APK

flutter build apk

A single APK containing multiple architectures can be larger than architecture-specific APKs.


31. AAB vs APK

FeatureAABAPK
Full NameAndroid App BundleAndroid Package
Primary UseGoogle Play distributionDirect installation/distribution
Installed DirectlyNo, normally distributed through a store/serviceYes
OptimizationStore can generate optimized APKsDeveloper provides APK
Typical Play Store ChoicePreferredAlternative

32. Test the App Bundle

Before production release, the generated AAB should be tested.

Testing Options

  • Upload the bundle to a Google Play testing track.
  • Use Google's testing facilities.
  • Generate APKs from the bundle using bundletool for local testing.

Testing is important because the application can behave differently after release packaging, signing, optimization, and resource processing.


33. Verify Application Permissions

Review all permissions requested by the application and its dependencies.

PermissionPossible Use
InternetAPI and network communication
CameraTaking photographs or scanning
LocationMaps and location services
NotificationsPush and local notifications
Storage-related permissionsFile or media access depending on Android version and implementation

Only request permissions that are actually necessary for the application's functionality.


34. Check Firebase Configuration

If the Flutter application uses Firebase, verify that the production application is connected to the correct Firebase project.

Check

  • Firebase project
  • Android application ID
  • Firebase configuration file
  • Authentication settings
  • Firestore rules
  • Storage rules
  • Cloud Messaging configuration
  • Production API configuration

Never accidentally release an application configured against a development Firebase project when the production application requires a separate environment.


35. Review Authentication and Security

Security checks are an important part of release preparation.

  • Do not hard-code passwords.
  • Do not expose private API keys unnecessarily.
  • Do not store authentication tokens insecurely.
  • Use HTTPS for network communication.
  • Validate authentication failures.
  • Check logout behavior.
  • Protect administrative functionality.
  • Remove test accounts and test credentials.

36. Check App Startup

The application should start correctly after a fresh installation.

Test Scenario

Install App
    ↓
Launch App
    ↓
Display Splash/Initial Screen
    ↓
Initialize Services
    ↓
Load Required Data
    ↓
Display Home Screen

Check startup behavior when the device is offline, when services fail, and when the user launches the application for the first time.


37. Check Application Updates

Before publishing a new version, consider how users will update from the previous version.

Test

  • Install the previous version.
  • Install the new release over it.
  • Verify that user data remains available where expected.
  • Check database migrations.
  • Check authentication state.
  • Check preferences and local storage.

38. Common Release Problems

ProblemPossible CauseSolution
Signing errorIncorrect keystore configurationCheck key.properties and Gradle configuration
Wrong app nameManifest label not updatedUpdate android:label
Wrong API URLDevelopment configuration usedUse production configuration
Missing iconIcon assets not configured correctlyReview launcher icon configuration
Build failureDependency or Gradle issueRun flutter clean and review dependencies
App crashes only in releaseRelease-specific configuration issueTest with flutter run --release and inspect logs
Large application sizeLarge assets or unnecessary dependenciesOptimize assets and dependencies
Version rejectedBuild number/version issueIncrease the version/build number

39. Useful Flutter Release Commands

CommandPurpose
flutter doctorCheck Flutter environment
flutter cleanRemove generated build files
flutter pub getInstall project dependencies
flutter pub outdatedCheck outdated dependencies
flutter run --releaseRun application in release mode
flutter build appbundleBuild Android App Bundle
flutter build apkBuild Android APK
flutter build apk --split-per-abiBuild ABI-specific APKs
flutter installInstall an APK on a connected Android device

40. Complete Release Checklist

  • Application name finalized
  • Application icon finalized
  • Application ID verified
  • Version number updated
  • Build number increased
  • Production API configured
  • Development data removed
  • Debug-only functionality removed
  • Dependencies reviewed
  • Assets reviewed
  • Permissions reviewed
  • Firebase configuration checked
  • Authentication tested
  • Offline behavior tested
  • Release signing configured
  • Keystore secured
  • Release build tested
  • Physical device testing completed
  • Application Bundle generated
  • AAB tested before production
  • Store listing prepared
  • Final production build archived securely

41. Practical Example: Preparing an App for Release

Step 1: Check the Environment

flutter doctor

Step 2: Get Dependencies

flutter pub get

Step 3: Clean the Project

flutter clean
flutter pub get

Step 4: Update Version

version: 1.2.0+10

Step 5: Test Release Mode

flutter run --release

Step 6: Build App Bundle

flutter build appbundle

Step 7: Locate the Bundle

build/app/outputs/bundle/release/app.aab

Step 8: Test Before Publishing

Upload the AAB to an appropriate testing track or test the bundle locally using the Android bundle testing workflow.


42. Recommended Release Workflow for a Real Project

Feature Development
        ↓
Code Review
        ↓
Unit/Widget Testing
        ↓
Integration Testing
        ↓
Production Configuration
        ↓
Version Update
        ↓
Release Signing
        ↓
flutter clean
        ↓
flutter pub get
        ↓
flutter run --release
        ↓
Physical Device Testing
        ↓
flutter build appbundle
        ↓
AAB Testing
        ↓
Final Review
        ↓
Store Submission
        ↓
Production Release

43. Best Practices for Flutter Release Preparation

  • Always test the release build instead of testing only debug builds.
  • Keep production and development environments separate.
  • Use a unique and permanent application ID.
  • Increase the build number for every Android release.
  • Protect keystore files and passwords.
  • Do not commit signing credentials to Git.
  • Remove unnecessary dependencies and assets.
  • Test on physical Android devices.
  • Review all permissions before publishing.
  • Use HTTPS for production APIs.
  • Keep obfuscation symbol files when using Dart obfuscation.
  • Maintain a secure backup of release credentials.
  • Test application updates, not only fresh installations.
  • Keep a copy of every production release artifact.

44. Interview Questions

Q1. What is a release build in Flutter?

A release build is the optimized production version of a Flutter application intended for distribution to end users.

Q2. What command is used to create an Android App Bundle?

flutter build appbundle

Q3. What is the difference between AAB and APK?

An AAB is a publishing format that allows Google Play to generate optimized APKs for users, while an APK is an installable Android package that can be distributed directly.

Q4. Why is application signing required?

Signing provides a cryptographic identity for the application and is required for Android application distribution and updates.

Q5. Where is the Android application ID configured?

It is configured in the Android Gradle build configuration using the applicationId property.

Q6. Where is the Flutter application version defined?

The version is normally defined in pubspec.yaml using the version property.

Q7. Why should release builds be tested separately?

Release builds use different optimization and packaging behavior from debug builds, so testing release mode helps identify production-specific problems.

Q8. Why should the keystore be protected?

The keystore and its credentials are sensitive signing information and should not be exposed publicly.

Q9. What command runs a Flutter application in release mode?

flutter run --release

Q10. What is the purpose of versionCode and versionName?

versionCode identifies the Android build internally, while versionName is the user-visible version of the application.


45. Summary

Preparing a Flutter application for release is more than simply generating an APK or AAB. A production-ready application should have the correct application name, icon, application ID, version, production configuration, permissions, dependencies, signing setup, and optimized release build.

The basic Android release process is:

Review Application
      ↓
Update Configuration
      ↓
Update Version
      ↓
Configure Signing
      ↓
Test Release Mode
      ↓
Build AAB/APK
      ↓
Test Release Package
      ↓
Publish

For Google Play distribution, the Android App Bundle is generally the preferred format:

flutter build appbundle

After successfully generating and testing the release package, the application can move through the appropriate store testing and production publishing process.


46. Learn More About Flutter

JustAcademy Flutter Training Course

Register for Flutter Course Demo

Previous Next
whatsapp